
#ifndef _TTG_STRUCTURES_NAMED_OBJECT_
#define _TTG_STRUCTURES_NAMED_OBJECT_
#include "Common/Definitions.h"

#include <string>

namespace ttg
{
	namespace structures
	{
		//Represents abstract object with unique name.
		class NamedObject
		{
			private:
				std::string name;
			public:
				//Creates NamedObject with specified name (which will be copied).
				inline NamedObject(const std::string &name)
						{  this->name = name; }
				//Creates NamedObject with specified name (which will be copied).
				inline NamedObject(const char *name)
						{  this->name = name; }
				//returns name as const string&
				inline const std::string &getStringName() const
						{ return name; }
				//returns name
				inline const char *getName() const
						{ return name.c_str(); }
				//Changes name of object.
				inline void setName(const char *name)
						{ this->name = name; }
				//NameObject, you are free !!!
				virtual ~NamedObject()
						{ /*nothing*/ }
		};

		//Wraps arbitrary object as named.
		template <class T>
		class NamedWrapper :public NamedObject
		{
			private:
				T &item;
			public:
				//Creates wrapper for given item.
				NamedWrapper(T &object, const char *name)
					:NamedObject(name), item(object)
						{ /*nothing*/ }
				//Returns assosiated object.
				inline T &getObject()
						{ return item; }
		};
	}
}

#endif
